/*
 * Copyright 2012 NJUT  qixiaobo. All rights reserved.
 */
package com.fujitsu.nanjing.tieba.service;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.fujitsu.nanjing.tieba.base.BaseService;
import com.fujitsu.nanjing.tieba.ibator.CoreSection;
import com.fujitsu.nanjing.tieba.ibator.CoreSectionCriteria;
import com.fujitsu.nanjing.tieba.model.Section;

/**
 * SectionService.java
 * 
 * @author Qixiaobo-win8
 */
@Transactional
@Service
public class SectionService
		extends
			BaseService<CoreSection, CoreSectionCriteria> {
	@Resource
	private Section section;
	@Override
	public CoreSection findById(String id) {
		return section.selectByPrimaryKey(Integer.parseInt(id));
	}

	@Override
	public CoreSection insert(CoreSection t) {
		section.insert(t);
		return t;
	}

	@Override
	public void update(CoreSection t) {
		section.updateByPrimaryKey(t);

	}

	@Override
	public void delete(CoreSection t) {
		section.deleteByPrimaryKey(t.getSectionid());

	}
	public List<CoreSection> findAll() {
		CoreSectionCriteria example = new CoreSectionCriteria();
		example.createCriteria();
		return section.selectByExample(example);
	}
}
